import React, { PureComponent } from 'react'

export class App extends PureComponent {
    constructor(){
        super()
        this.state={
            inputText:'hello'
        }
    }
    inputChange(e){
        console.log(e.target.value);
        this.setState({
            inputText:e.target.value
        })
    }
  render() {
    const {inputText} =this.state;
    return (
      <div>
        {/* 受控组件 绑定value 并监听value 的函数*/}
        <input type="text" value={inputText}  onChange={(e)=>this.inputChange(e)}/>
        {/* 非受控组件 */}
        <input type="text" />
        <p>{inputText}</p>
      </div>
    )
  }
}

export default App